package com.synjones.zeuscloudweb.service.impl;

import com.synjones.zeus.model.web.AdminBean;
import com.synjones.zeus.model.web.AdminRoleMenuBean;
import com.synjones.zeuscloudweb.service.LoginService;
import com.synjones.zeuscloudweb.dao.LoginDaoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author  yys
 * Description: 登陆ServiceImp
 * @date  created in 16:50 2017/12/28
 * Modified by:
 */
@Service
public class LoginServiceImpl implements LoginService{
    @Resource
    private LoginDaoMapper loginDaoMapper;
    /**
     *  根据用户名获取用户信息
     *  @param username 用户名
     *  @author yys
     *  Description:  获取用户信息
     *  @date: 16:53 2017/12/28
     *  @return  AdminVO
     *  throws  Exception
     */
    @Override
    public AdminBean findUserByName(String username) {
        return loginDaoMapper.findUserByName(username);
    }
    /**
     *  根据用户ID获取用户权限菜单
     *  @param userId 用户ID
     *  @author yys
     *  Description:  获取用户权限菜单
     *  @date: 16:53 2017/12/28
     *  @return  AdminVO
     *  throws  Exception in case of any kind of processing failure
     */
    @Override
    public List<AdminRoleMenuBean> findAdminRoleMenuByUserId(String userId) {
        return loginDaoMapper.findAdminRoleMenuByUserId(userId);
    }
    /**
     *  根据用户ID获取用户角色
     *  @param userId 用户ID
     *  @author yys
     *  Description:  获取用户角色
     *  @date: 16:53 2017/12/28
     *  @return  String
     *  throws  Exception
     */
    @Override
    public String findRoleNameByUserId(String userId) {
        return loginDaoMapper.findRoleNameByUserId(userId);
    }

}
